﻿#include "rpc_client.h"
#include<windows.h>
#include "response_listener.h"
//#include <stdio.h>


#include <event2/event.h>
#include<event2/thread.h>

#include "data_hub.h"
void timer_cb(int fd, short event, void* arg)    //回调函数
{
	printf("timer_cb\n");
	//event_add(ev, &tv);    //重新注册
}

int main(int argc, char* argv[]) {
	SetConsoleOutputCP(CP_UTF8);
#ifdef _WIN32
	WSADATA wsa_data;
	WSAStartup(0x0201, &wsa_data);
#endif

	evthread_use_windows_threads();
	
	
	RpcClient client("127.0.0.1:5000");
	 ResponseListener response(client.complettionQueue());
	 response.start();
	 DataHub dh(&client);
	auto t= dh.start();
	auto e = std::make_unique<Event>();
	e->type = 0;
	EventLoop::postEvent(t,std::move(e));
	 //std::async(std::launch::async,dh.event())
	while (true);
	return 0;
}